#ifndef NETWORKSCAN_H
#define NETWORKSCAN_H

#include <QObject>
#include <QHostInfo>
#include <QTimer>

namespace ns_yht
{

    class /*COMMONUTILS_EXPORT*/ NetworkScan : public QObject
    {
        Q_OBJECT
    public:
        NetworkScan();
        ~NetworkScan();

    public slots:
        void run();
        void stop();

    private slots:
        void scan();
        void slot_lookup(QHostInfo hostinfo);

    signals:
        void deviceSerialError();
        void statusChanged(bool connected);
        void statusRefreshed(bool connected);

    private:
        void removeOldFiles();

        int m_status{-1}; //-1：未检测；1-通；0-断
        bool m_isScanning;

        QTimer *m_timer{nullptr};
    };

} // namespace ns_yht

#endif // NETWORKSCAN_H
